package std.lang;

import org.junit.Test;

public class Class {

    @Test
    public void getResource() {
        //file:/C:/Users/zing/workspace/java/hello-java/build/classes/java/test/std/lang/
        System.out.println(Class.class.getResource(""));
        //file:/C:/Users/zing/workspace/java/hello-java/build/classes/java/test/
        System.out.println(Class.class.getResource("/"));

        //file:/C:/Users/zing/workspace/java/hello-java/build/classes/java/test/
        System.out.println(Class.class.getClassLoader().getResource(""));
        //null
        System.out.println(Class.class.getClassLoader().getResource("/"));

        //file:/C:/Users/zing/workspace/java/hello-java/build/classes/java/test/
        System.out.println(ClassLoader.getSystemResource(""));
        //null
        System.out.println(ClassLoader.getSystemResource("/"));

        //C:\Users\zing\workspace\java\hello-java
        System.out.println(System.getProperty("user.dir"));
    }
}
